import type { favoriteItem } from '@/types/favorite'
import type { PageParams, PageResult } from '@/types/global'
import { request } from '@/utils/request'

export const getFavoriteListApi = (data: PageParams) => {
  return request<PageResult<favoriteItem[]>>({
    url: '/userFavorite/list',
    method: 'GET',
    data,
  })
}

export const postAddFavoriteApi = (data: { goods_id: number }) => {
  return request({
    url: '/userFavorite/add',
    method: 'POST',
    data,
  })
}

export const postCancelFavoriteApi = (data: { goods_id: string | number; is_all?: boolean }) => {
  return request({
    url: '/userFavorite/delete',
    method: 'POST',
    data,
  })
}
